// 定义语句块
// 定义语句块下面对应的代码块
// 定义块
const Path = require('path');
const dir = Path.join(__dirname, 'static');

 function ArduinoUnoBlocks (Blockly) {
	 var color_arduino = '#00979D';
	 var color_serial = '#FF4482';
	 var color_sensor = '#28BFE6';
	 var color_do = '#FF0000';
	 var color_display = '#f59057';
   //模式
//    Blockly.Blocks.control_setup_loop = {
//     /**
//      * Block for if-else.
//      * @this Blockly.Block
//      */
//     init: function () {
//         this.jsonInit({
//             type: 'control_setup_loop',
//             message0: '',
//             message1: Blockly.Msg.BOOT_SETUP,
//             message2: '%1 ',
//             message3: 'loop',
//             message4: '%1',
//             args0: [],
//             args1: [],
//             args2: [
//                 {
//                     type: 'input_statement',
//                     name: 'SUBSTACK0'
//                 }
//             ],
//             args3: [],
//             args4: [
//                 {
//                     type: 'input_statement',
//                     name: 'SUBSTACK2'
//                 }
//             ],
//             category: Blockly.Categories.control,
//             // extensions: ['colours_arduino', 'scratch_extension']
//         });
//     }
// };
// Blockly.ScratchBlocks.VerticalExtensions.ARDUINO = function() {
//   this.setColour('#0097A7');
// };
// Blockly.Extensions.register('colours_arduino',Blockly.ScratchBlocks.VerticalExtensions.ARDUINO);

Blockly.Blocks.inout_pinMode1 = {
init:function(){
this.setColour(color_arduino);
this.appendDummyInput("")
   .appendField(Blockly.Msg.ARDUINO_PINS)
    .appendField(new Blockly.FieldDropdown([
      ['0', "0"],
      ['1', "1"],
      ['2', "2"],
      ['3', "3"],
      ['4', "4"],
      ['5', "5"],
      ['6', "6"],
      ['7', "7"],
      ['8', "8"],
      ['9', "9"],
      ['10', "10"],
      ['11', "11"],
      ['12', "12"],
      ['13', "13"],
      ['A0', "A0"],
      ['A1', "A1"],
      ['A2', "A2"],
      ['A3', "A3"],
      ['A4', "A4"],
      ['A5', "A5"],
    ]),"PINS")
    this.appendDummyInput("")
       .appendField(Blockly.Msg.ARDUINO_MODE)
        .appendField(new Blockly.FieldDropdown([
          [Blockly.Msg.ARDUINO_INPUT, "INPUT"],
          [Blockly.Msg.ARDUINO_OUTPUT, "OUTPUT"],
          [Blockly.Msg.ARDUINO_INPUTPULLUP, "INPUT_PULLUP"],
        ]),"MODE")
this.setPreviousStatement(true,null);
  this.setNextStatement(true,null);
this.setTooltip('');
}
};
//数字写
Blockly.Blocks.digitalWrite = {
init:function(){
 this.setColour(color_arduino);
 this.appendDummyInput("")
    .appendField(Blockly.Msg.ARDUINO_DIGITALWRITE)
     .appendField(new Blockly.FieldDropdown([
       ['0', "0"],
       ['1', "1"],
       ['2', "2"],
       ['3', "3"],
       ['4', "4"],
       ['5', "5"],
       ['6', "6"],
       ['7', "7"],
       ['8', "8"],
       ['9', "9"],
       ['10', "10"],
       ['11', "11"],
       ['12', "12"],
       ['13', "13"],
       ['A0', "A0"],
       ['A1', "A1"],
       ['A2', "A2"],
       ['A3', "A3"],
       ['A4', "A4"],
       ['A5', "A5"],
     ]),"PINS")
     this.appendDummyInput("")
         .appendField(new Blockly.FieldDropdown([
           ['HIGH', "1"],
           ['LOW', "0"],
         ]),"STATE")
 this.setPreviousStatement(true,null);
   this.setNextStatement(true,null);
 this.setTooltip('');
}
};
//模拟写
Blockly.Blocks.analogWrite = {
 init:function(){
  this.setColour(color_arduino);
  this.appendDummyInput("")
     .appendField(Blockly.Msg.ARDUINO_ANALOGWRITE)
      .appendField(new Blockly.FieldDropdown([
        ['3', "3"],
        ['5', "5"],
        ['6', "6"],
        ['9', "9"],
        ['10', "10"],
        ['11', "11"],
      ]),"analogPINS")
      this.appendValueInput("analogWrites", Number)
  this.setPreviousStatement(true,null);
    this.setNextStatement(true,null);
  this.setTooltip('');
 }
};
//数字读
 Blockly.Blocks.digitalRead = {
   init:function(){
    this.setColour(color_arduino);
    this.appendDummyInput("")
       .appendField(Blockly.Msg.ARDUINO_DIGITALREAD)
        .appendField(new Blockly.FieldDropdown([
          ['0', "0"],
          ['1', "1"],
          ['2', "2"],
          ['3', "3"],
          ['4', "4"],
          ['5', "5"],
          ['6', "6"],
          ['7', "7"],
          ['8', "8"],
          ['9', "9"],
          ['10', "10"],
          ['11', "11"],
          ['12', "12"],
          ['13', "13"],
          ['A0', "A0"],
          ['A1', "A1"],
          ['A2', "A2"],
          ['A3', "A3"],
          ['A4', "A4"],
          ['A5', "A5"],
        ]),"PINS")
        this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
     this.setOutput(true, 'Number');
    this.setTooltip('');
   }
  };
//模拟读
  Blockly.Blocks.analogRead = {
    init:function(){
     this.setColour(color_arduino);
     this.appendDummyInput("")
        .appendField(Blockly.Msg.ARDUINO_ANALOGREAD)
         .appendField(new Blockly.FieldDropdown([
           ['A0', "A0"],
           ['A1', "A1"],
           ['A2', "A2"],
           ['A3', "A3"],
           ['A4', "A4"],
           ['A5', "A5"],
         ]),"ANALOGPINS")
         this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
      this.setOutput(true, 'Number');
     this.setTooltip('');
    }
   };
//定时器执行
Blockly.Blocks.timer = {
init:function(){
this.setColour(color_arduino);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_TIMER)
this.appendValueInput("timers", Number)
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_MS);
   this.appendStatementInput('DO')
            .appendField(Blockly.Msg.ARDUINO_DO);
        this.setPreviousStatement(true);
        this.setNextStatement(true);
        this.setTooltip('');
}
};
//定时器启动
Blockly.Blocks.timeron = {
init:function(){
this.setColour(color_arduino);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_TIMERON)
        this.setPreviousStatement(true);
        this.setNextStatement(true);
        this.setTooltip('');
}
};
//定时器停止
Blockly.Blocks.timeroff = {
init:function(){
this.setColour(color_arduino);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_TIMEROFF)
        this.setPreviousStatement(true);
        this.setNextStatement(true);
        this.setTooltip('');
}
};
//系统运行时间
Blockly.Blocks.runtime = {
init:function(){
this.setColour(color_arduino);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_RUNTIME)
  .appendField(new Blockly.FieldDropdown([
  [Blockly.Msg.ARDUINO_MILLISECOND, "millis"],
  [Blockly.Msg.ARDUINO_MICROSECOND, "micros"],
]),"runtimes")
    this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
 this.setOutput(true, 'Number');
this.setTooltip('');
}
};
//管脚中断
Blockly.Blocks.pininterrupt = {
init:function(){
this.setColour(color_arduino);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_PININTERRUPT)
 .appendField(new Blockly.FieldDropdown([
          ['0', "0"],
          ['1', "1"],
          ['2', "2"],
          ['3', "3"],
          ['4', "4"],
          ['5', "5"],
          ['6', "6"],
          ['7', "7"],
          ['8', "8"],
          ['9', "9"],
          ['10', "10"],
          ['11', "11"],
          ['12', "12"],
          ['13', "13"],
          ['A0', "A0"],
          ['A1', "A1"],
          ['A2', "A2"],
          ['A3', "A3"],
          ['A4', "A4"],
          ['A5', "A5"],
        ]),"INTERRUPTPINS")
 .appendField(new Blockly.FieldDropdown([
          [Blockly.Msg.ARDUINO_RISING, "RISING"],
          [Blockly.Msg.ARDUINO_FALLING, "FALLING"],
          [Blockly.Msg.ARDUINO_CHANGE, "CHANGE"],
        ]),"INTERRUPT")
   this.appendStatementInput('DO')
            .appendField(Blockly.Msg.ARDUINO_DO);
        this.setPreviousStatement(true);
        this.setNextStatement(true);
        this.setTooltip('');
}
};
//脉冲长度（微秒）
Blockly.Blocks.pulse = {
init:function(){
this.setColour(color_arduino);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_PULSE)
 .appendField(new Blockly.FieldDropdown([
          ['0', "0"],
          ['1', "1"],
          ['2', "2"],
          ['3', "3"],
          ['4', "4"],
          ['5', "5"],
          ['6', "6"],
          ['7', "7"],
          ['8', "8"],
          ['9', "9"],
          ['10', "10"],
          ['11', "11"],
          ['12', "12"],
          ['13', "13"],
          ['A0', "A0"],
          ['A1', "A1"],
          ['A2', "A2"],
          ['A3', "A3"],
          ['A4', "A4"],
          ['A5', "A5"],
        ]),"PULSEPINS")
		.appendField(Blockly.Msg.ARDUINO_STATUS)
 .appendField(new Blockly.FieldDropdown([
           [Blockly.Msg.ARDUINO_HIGH, "HIGH"],
           [Blockly.Msg.ARDUINO_LOW, "LOW"],
        ]),"PULSES")
         this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
 this.setOutput(true, 'Number');
this.setTooltip('');
}
};
//脉冲长度超时
Blockly.Blocks.pulse2 = {
init:function(){
this.setColour(color_arduino);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_PULSE)
 .appendField(new Blockly.FieldDropdown([
          ['0', "0"],
          ['1', "1"],
          ['2', "2"],
          ['3', "3"],
          ['4', "4"],
          ['5', "5"],
          ['6', "6"],
          ['7', "7"],
          ['8', "8"],
          ['9', "9"],
          ['10', "10"],
          ['11', "11"],
          ['12', "12"],
          ['13', "13"],
          ['A0', "A0"],
          ['A1', "A1"],
          ['A2', "A2"],
          ['A3', "A3"],
          ['A4', "A4"],
          ['A5', "A5"],
        ]),"PULSEPINS")
		.appendField(Blockly.Msg.ARDUINO_STATUS)
 .appendField(new Blockly.FieldDropdown([
           [Blockly.Msg.ARDUINO_HIGH, "HIGH"],
           [Blockly.Msg.ARDUINO_LOW, "LOW"],
        ]),"PULSES")
		.appendField(Blockly.Msg.ARDUINO_TIMEOUT)
   this.appendValueInput("pulse2s", Number)
         this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
 this.setOutput(true, 'Number');
this.setTooltip('');
}
};
//串口波特率
Blockly.Blocks.serialbegin = {
init:function(){
this.setColour(color_serial);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_BAUDRATE)
  .appendField(new Blockly.FieldDropdown([
  ['Serial', "Serial"],
  ['Soft Serial', "softser"],
]),"SerialS1")
.appendField(Blockly.Msg.ARDUINO_BAUDRATES)
  .appendField(new Blockly.FieldDropdown([
    ['4800', "4800"],
    ['9600', "9600"],
    ['38400', "38400"],
    ['57600', "57600"],
    ['115200', "115200"],
  ]),"serialbegins")
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//串口打印字符不换行
Blockly.Blocks.serialprintstring = {
init:function(){
this.setColour(color_serial);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_BAUDRATE)
    .appendField(new Blockly.FieldDropdown([
  ['Serial', "Serial"],
  ['Soft Serial', "softser"],
]),"SerialS22")
.appendField(Blockly.Msg.ARDUINO_SERIALPRINTSTRINGS)
   this.appendValueInput("serialprints1", String)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//串口打印字符
Blockly.Blocks.serialprint = {
init:function(){
this.setColour(color_serial);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_BAUDRATE)
    .appendField(new Blockly.FieldDropdown([
  ['Serial', "Serial"],
  ['Soft Serial', "softser"],
]),"SerialS2")
.appendField(Blockly.Msg.ARDUINO_SERIALPRINTSTRING)
   this.appendValueInput("serialprints", String)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//串口打印数字不换行
Blockly.Blocks.serialprintnum1 = {
init:function(){
this.setColour(color_serial);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_BAUDRATE)
    .appendField(new Blockly.FieldDropdown([
  ['Serial', "Serial"],
  ['Soft Serial', "softser"],
]),"SerialS33")
.appendField(Blockly.Msg.ARDUINO_SERIALPRINTNUMBERS)
   this.appendValueInput("serialprintsss", Number)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//串口打印数字
Blockly.Blocks.serialprintnum = {
init:function(){
this.setColour(color_serial);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_BAUDRATE)
    .appendField(new Blockly.FieldDropdown([
  ['Serial', "Serial"],
  ['Soft Serial', "softser"],
]),"SerialS3")
.appendField(Blockly.Msg.ARDUINO_SERIALPRINTNUMBER)
   this.appendValueInput("serialprintss", Number)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//串口打印16进制
Blockly.Blocks.serialprint16num = {
init:function(){
this.setColour(color_serial);
this.appendDummyInput("")
   .appendField(Blockly.Msg.ARDUINO_BAUDRATE)
     .appendField(new Blockly.FieldDropdown([
  ['Serial', "Serial"],
  ['Soft Serial', "softser"],
]),"SerialS4")
.appendField(Blockly.Msg.ARDUINO_SERIALPRINTHEX)
    this.appendValueInput("serialprint16nums", Number)
this.setPreviousStatement(true,null);
  this.setNextStatement(true,null);
this.setTooltip('');
}
};
//串口有数据可读
Blockly.Blocks.serialava = {
init:function(){
this.setColour(color_serial);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_PORT)
.appendField(new Blockly.FieldDropdown([
  ['Serial', "Serial"],
  ['Soft Serial', "softser"],
]),"SerialS")
  .appendField(Blockly.Msg.ARDUINO_SERIALAVALIBLE)
   this.setOutputShape(Blockly.OUTPUT_SHAPE_HEXAGONAL);
this.setOutput(true, 'Boolean');
this.setTooltip('');
}
};
//串口读取字节
Blockly.Blocks.serialread = {
init:function(){
this.setColour(color_serial);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_PORT)
.appendField(new Blockly.FieldDropdown([
  ['Serial', "Serial"],
  ['Soft Serial', "softser"],
]),"Serials")
   .appendField(Blockly.Msg.ARDUINO_SERIALREAD)
    this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
 this.setOutput(true, 'Number');
this.setTooltip('');
}
};
//串口读取整数小数
Blockly.Blocks.serialreadint = {
init:function(){
this.setColour(color_serial);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_PORT)
.appendField(new Blockly.FieldDropdown([
  ['Serial', "Serial"],
  ['Soft Serial', "softser"],
]),"Serials9")
   .appendField(Blockly.Msg.ARDUINO_SERIALREADINTS)
   .appendField(new Blockly.FieldDropdown([
     [Blockly.Msg.ARDUINO_SERIALREADINT, "parseInt()"],
     [Blockly.Msg.ARDUINO_SERIALREADFLOAT, "parseFloat"],
   ]),"intfloat")
    this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
 this.setOutput(true, 'Number');
this.setTooltip('');
}
};
//类型转换
// Blockly.Blocks.changetype = {
// init:function(){
//  this.setColour(color_arduino);
//  this.appendDummyInput("")
//     .appendField(Blockly.Msg.ARDUINO_CHANGETYPE)
//      .appendField(new Blockly.FieldDropdown([
//        ['byte', "byte"],
//        ['char', "char"],
//        ['int', "int"],
//        ['long', "long"],
//        ['float', "float"],
//      ]),"types")
//       this.appendValueInput("changetypes", Number)
//      this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
//   this.setOutput(true);
//  this.setTooltip('');
// }
// };
// //类型转换2
// Blockly.Blocks.changetypes = {
// init:function(){
//  this.setColour(color_arduino);
//  this.appendDummyInput("")
//     .appendField(Blockly.Msg.ARDUINO_CHANGETYPES)
//       this.appendValueInput("changetypess", String)
//      this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
//   this.setOutput(true,);
//  this.setTooltip('');
// }
// };
//软串口
Blockly.Blocks.softserial = {
init:function(){
this.setColour(color_serial);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_SOFTSERIAL_TX)
  .appendField(new Blockly.FieldDropdown([
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"TX1")
  .appendField(Blockly.Msg.ARDUINO_SOFTSERIAL_RX)
  .appendField(new Blockly.FieldDropdown([
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"RX1")
  .appendField(Blockly.Msg.ARDUINO_SOFTSERIALBAUDRATE)
  this.setPreviousStatement(true,null);
   this.setNextStatement(true,null);
  this.setTooltip('');
  }
  };
  //串口中断
Blockly.Blocks.serial_event = {
init:function(){
this.setColour(color_serial);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_PORT)
.appendField(new Blockly.FieldDropdown([
  ['Serial', "Serial"],
  ['Soft Serial', "softser"],
]),"Serials")
.appendField(Blockly.Msg.ARDUINO_INTERRUPUT);
   this.appendStatementInput('DO')
            .appendField(Blockly.Msg.ARDUINO_DO);
        this.setPreviousStatement(true);
        this.setNextStatement(true);
        this.setTooltip('');
}
};
//串口清空缓存区数据
Blockly.Blocks.serial_flush = {
init:function(){
this.setColour(color_serial);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_PORT)
.appendField(new Blockly.FieldDropdown([
  ['Serial', "Serial"],
  ['Soft Serial', "softser"],
]),"Serials")
.appendField(Blockly.Msg.ARDUINO_FLUSH);
        this.setPreviousStatement(true);
        this.setNextStatement(true);
        this.setTooltip('');
}
};
//串口读取字符串
Blockly.Blocks.serial_read = {
init:function(){
this.setColour(color_serial);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_PORT)
.appendField(new Blockly.FieldDropdown([
  ['Serial', "Serial"],
  ['Soft Serial', "softser"],
]),"Serials")
  .appendField(Blockly.Msg.ARDUINO_READSTRING)
  this.appendValueInput("serialprints2", String)
       this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
    this.setOutput(true);
this.setTooltip('');
}
};
//超声波初始化
Blockly.Blocks.ultrasonicinit = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_INITULTRASONIC_TRIGPIN)
   .appendField(new Blockly.FieldDropdown([
     ['0', "0"],
     ['1', "1"],
     ['2', "2"],
     ['3', "3"],
     ['4', "4"],
     ['5', "5"],
     ['6', "6"],
     ['7', "7"],
     ['8', "8"],
     ['9', "9"],
     ['10', "10"],
     ['11', "11"],
     ['12', "12"],
     ['13', "13"],
     ['A0', "A0"],
     ['A1', "A1"],
     ['A2', "A2"],
     ['A3', "A3"],
     ['A4', "A4"],
     ['A5', "A5"],
   ]),"TRIGs")
   this.appendDummyInput("")
     .appendField(Blockly.Msg.ARDUINO_ECHOPIN)
       .appendField(new Blockly.FieldDropdown([
         ['0', "0"],
         ['1', "1"],
         ['2', "2"],
         ['3', "3"],
         ['4', "4"],
         ['5', "5"],
         ['6', "6"],
         ['7', "7"],
         ['8', "8"],
         ['9', "9"],
         ['10', "10"],
         ['11', "11"],
         ['12', "12"],
         ['13', "13"],
         ['A0', "A0"],
         ['A1', "A1"],
         ['A2', "A2"],
         ['A3', "A3"],
         ['A4', "A4"],
         ['A5', "A5"],
       ]),"ECHOs")
       this.setPreviousStatement(true,null);
        this.setNextStatement(true,null);
       this.setTooltip('');
       }
       };
//超声波读值

Blockly.Blocks.ultrasonicdistance = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_ULTRASONICCHECKDISTANCE)
       this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
    this.setOutput(true);
this.setTooltip('');
}
};
//dht初始化
Blockly.Blocks.initdht = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_INITDHT11PIN)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
     ['1', "1"],
     ['2', "2"],
     ['3', "3"],
     ['4', "4"],
     ['5', "5"],
     ['6', "6"],
     ['7', "7"],
     ['8', "8"],
     ['9', "9"],
     ['10', "10"],
     ['11', "11"],
     ['12', "12"],
     ['13', "13"],
     ['A0', "A0"],
     ['A1', "A1"],
     ['A2', "A2"],
     ['A3', "A3"],
     ['A4', "A4"],
     ['A5', "A5"],
   ]),"PINSs")
   this.setPreviousStatement(true,null);
        this.setNextStatement(true,null);
this.setTooltip('');
}
};
//dht
Blockly.Blocks.dht = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_DHT11PIN)


   this.appendDummyInput("")
       .appendField(new Blockly.FieldDropdown([
         [Blockly.Msg.ARDUINO_DHT11GETTEMP, "temperature"],
         [Blockly.Msg.ARDUINO_DHT11GETHUM, "humidity"],
       ]),"temhum")
       this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
    this.setOutput(true, 'Number');
this.setTooltip('');
}
};
//舵机初始化
Blockly.Blocks.initservo = {
init:function(){
this.setColour(color_do);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_INITSERVOPIN)
   .appendField(new Blockly.FieldDropdown([
     ['0', "0"],
     ['1', "1"],
     ['2', "2"],
     ['3', "3"],
     ['4', "4"],
     ['5', "5"],
     ['6', "6"],
     ['7', "7"],
     ['8', "8"],
     ['9', "9"],
     ['10', "10"],
     ['11', "11"],
     ['12', "12"],
     ['13', "13"],
     ['A0', "A0"],
     ['A1', "A1"],
     ['A2', "A2"],
     ['A3', "A3"],
     ['A4', "A4"],
     ['A5', "A5"],
   ]),"servopinss")
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//舵机
Blockly.Blocks.servo = {
init:function(){
this.setColour(color_do);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_SERVOPIN)
   .appendField(new Blockly.FieldDropdown([
     ['0', "0"],
     ['1', "1"],
     ['2', "2"],
     ['3', "3"],
     ['4', "4"],
     ['5', "5"],
     ['6', "6"],
     ['7', "7"],
     ['8', "8"],
     ['9', "9"],
     ['10', "10"],
     ['11', "11"],
     ['12', "12"],
     ['13', "13"],
     ['A0', "A0"],
     ['A1', "A1"],
     ['A2', "A2"],
     ['A3', "A3"],
     ['A4', "A4"],
     ['A5', "A5"],
   ]),"servopins")
   .appendField(Blockly.Msg.ARDUINO_SERVOANGLE)
   this.appendValueInput("servoangle", Number)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//lcd配置地址
Blockly.Blocks.lcdinit = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_LCDINIT_ADDRESS)
   this.appendValueInput("lcdinits", Number)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};

//lcd光标
Blockly.Blocks.lcdposition = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_POSITION)
   this.appendValueInput("row", Number)
   .appendField(Blockly.Msg.ARDUINO_ROW)
   this.appendValueInput("col", Number)
   .appendField(Blockly.Msg.ARDUINO_COL)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//lcd打印
Blockly.Blocks.lcdprint = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_LCDPRINT)
   this.appendValueInput("lcdprints", String)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//lcd清屏
Blockly.Blocks.lcdclear = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_LCDCLEAR)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//红外发送
Blockly.Blocks.irsend = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
   .appendField(Blockly.Msg.ARDUINO_IRSENDPIN)
   .appendField(new Blockly.FieldDropdown([
    //   ['0', "0"],
    //  ['1', "1"],
    //  ['2', "2"],
     ['3', "3"],
    //  ['4', "4"],
    //  ['5', "5"],
    //  ['6', "6"],
    //  ['7', "7"],
    //  ['8', "8"],
    //  ['9', "9"],
    //  ['10', "10"],
    //  ['11', "11"],
    //  ['12', "12"],
    //  ['13', "13"],
    //  ['A0', "A0"],
    //  ['A1', "A1"],
    //  ['A2', "A2"],
    //  ['A3', "A3"],
    //  ['A4', "A4"],
    //  ['A5', "A5"],
   ]),"irpins")
    this.appendValueInput("irdata", Number)
    .appendField(Blockly.Msg.ARDUINO_IRDATA)
    this.appendValueInput("irbyte", Number)
    .appendField(Blockly.Msg.ARDUINO_IRBYTE)
this.setPreviousStatement(true,null);
  this.setNextStatement(true,null);
this.setTooltip('');
}
};
//红外接收初始化
Blockly.Blocks.initirreceive = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
   .appendField(Blockly.Msg.ARDUINO_INITIRSENDPIN)
   .appendField(new Blockly.FieldDropdown([
     ['0', "0"],
     ['1', "1"],
     ['2', "2"],
     ['3', "3"],
     ['4', "4"],
     ['5', "5"],
     ['6', "6"],
     ['7', "7"],
     ['8', "8"],
     ['9', "9"],
     ['10', "10"],
     ['11', "11"],
     ['12', "12"],
     ['13', "13"],
     ['A0', "A0"],
     ['A1', "A1"],
     ['A2', "A2"],
     ['A3', "A3"],
     ['A4', "A4"],
     ['A5', "A5"],
   ]),"irpinss")
this.setPreviousStatement(true,null);
  this.setNextStatement(true,null);
this.setTooltip('');
}
};
//红外接收
Blockly.Blocks.irreceive = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  //.appendField(Blockly.Msg.ARDUINO_IRRECEIVEPIN)
  .appendField(Blockly.Msg.ARDUINO_IRRECEIVEDDATA)
   this.setOutputShape(Blockly.OUTPUT_SHAPE_HEXAGONAL);
this.setOutput(true, 'Boolean');
this.setTooltip('');
}
};
//红外接收的数据
Blockly.Blocks.irgetdate = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_DATAIRRECEIVED)
   this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
this.setOutput(true, 'Number');
this.setTooltip('');
}
};
//红外接收下一个值
Blockly.Blocks.irgetnextdate = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_DATAIRRECEIVEDNEXT)
this.setPreviousStatement(true,null);
  this.setNextStatement(true,null);
this.setTooltip('');
}
};
//tm1637数码管初始化
Blockly.Blocks.inittm1637 = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_TM1637INIT_CLKPIN)
   .appendField(new Blockly.FieldDropdown([
     ['0', "0"],
     ['1', "1"],
     ['2', "2"],
     ['3', "3"],
     ['4', "4"],
     ['5', "5"],
     ['6', "6"],
     ['7', "7"],
     ['8', "8"],
     ['9', "9"],
     ['10', "10"],
     ['11', "11"],
     ['12', "12"],
     ['13', "13"],
     ['A0', "A0"],
     ['A1', "A1"],
     ['A2', "A2"],
     ['A3', "A3"],
     ['A4', "A4"],
     ['A5', "A5"],
   ]),"PINS")
   this.appendDummyInput("")
   .appendField(Blockly.Msg.ARDUINO_DIOPIN)
       .appendField(new Blockly.FieldDropdown([
         ['0', "0"],
         ['1', "1"],
         ['2', "2"],
         ['3', "3"],
         ['4', "4"],
         ['5', "5"],
         ['6', "6"],
         ['7', "7"],
         ['8', "8"],
         ['9', "9"],
         ['10', "10"],
         ['11', "11"],
         ['12', "12"],
         ['13', "13"],
         ['A0', "A0"],
         ['A1', "A1"],
         ['A2', "A2"],
         ['A3', "A3"],
         ['A4', "A4"],
         ['A5', "A5"],
       ]),"PINSS")
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//tm1637设置亮度
Blockly.Blocks.tm1637setlight = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
   .appendField(Blockly.Msg.ARDUINO_TM1637LIGHT)
    this.appendValueInput("tm1637setlights", Number)
this.setPreviousStatement(true,null);
  this.setNextStatement(true,null);
this.setTooltip('');
}
};
//tm1637显示
Blockly.Blocks.tm1637print = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_TM1637PRINT)
   this.appendValueInput("tm1637prints", String)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//tm1637清屏
Blockly.Blocks.tm1637clear = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_TM1637CLEAR)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//初始化步进电机
Blockly.Blocks.initstepper = {
init:function(){
this.setColour(color_do);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_INITSTEPPER_PIN1)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINS1")
  .appendField(Blockly.Msg.ARDUINO_INITSTEPPER_PIN2)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINS2")
  .appendField(Blockly.Msg.ARDUINO_INITSTEPPER_PIN3)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINS3")
  .appendField(Blockly.Msg.ARDUINO_INITSTEPPER_PIN4)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINS4")
   this.appendValueInput("eachroundsteps", Number)
   .appendField(Blockly.Msg.ARDUINO_STEPPERROUND)
   this.appendValueInput("stepperspeed", Number)
   .appendField(Blockly.Msg.ARDUINO_SETSPEED)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//步进电机移动步数
Blockly.Blocks.steppermove = {
init:function(){
this.setColour(color_do);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_STEPPERSTEPS)
   this.appendValueInput("steppermoves", Number)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//单电机
Blockly.Blocks.dcmotor = {
init:function(){
this.setColour(color_do);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_DCMOTOR_DIRECTIONPIN)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINS1")
  .appendField(Blockly.Msg.ARDUINO_DCMOTORSPEEDPIN)
  .appendField(new Blockly.FieldDropdown([
    ['3', "3"],
    ['5', "5"],
    ['6', "6"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
  ]),"PINS2")
   this.appendValueInput("dcmotors", Number)
   .appendField(Blockly.Msg.ARDUINO_DCMOTORSPEED)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//单电机驱动
Blockly.Blocks.dcmotor2 = {
init:function(){
this.setColour(color_do);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_DCMOTOR_PIN1)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINS1")
   .appendField(Blockly.Msg.ARDUINO_DCMOTOR_PIN2)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINS2")
  .appendField(Blockly.Msg.ARDUINO_DCMOTOR_PWM)
  .appendField(new Blockly.FieldDropdown([
    ['3', "3"],
    ['5', "5"],
    ['6', "6"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
  ]),"pwm")
   this.appendValueInput("dcmotors2", Number)
   .appendField(Blockly.Msg.ARDUINO_DCMOTORSPEED)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//蜂鸣器初始化
Blockly.Blocks.buzzerinit = {
init:function(){
this.setColour(color_do);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_BUZZERINIT_PIN)
    .appendField(new Blockly.FieldDropdown([
      ['0', "0"],
      ['1', "1"],
      ['2', "2"],
      ['3', "3"],
      ['4', "4"],
      ['5', "5"],
      ['6', "6"],
      ['7', "7"],
      ['8', "8"],
      ['9', "9"],
      ['10', "10"],
      ['11', "11"],
      ['12', "12"],
      ['13', "13"],
      ['A0', "A0"],
      ['A1', "A1"],
      ['A2', "A2"],
      ['A3', "A3"],
      ['A4', "A4"],
      ['A5', "A5"],
    ]),"buzzerinits")
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//蜂鸣器播放
Blockly.Blocks.buzzerplay = {
init:function(){
this.setColour(color_do);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_BUZZERPLAY_PIN)
    .appendField(new Blockly.FieldDropdown([
      ['0', "0"],
      ['1', "1"],
      ['2', "2"],
      ['3', "3"],
      ['4', "4"],
      ['5', "5"],
      ['6', "6"],
      ['7', "7"],
      ['8', "8"],
      ['9', "9"],
      ['10', "10"],
      ['11', "11"],
      ['12', "12"],
      ['13', "13"],
      ['A0', "A0"],
      ['A1', "A1"],
      ['A2', "A2"],
      ['A3', "A3"],
      ['A4', "A4"],
      ['A5', "A5"],
    ]),"buzzerinits")
    this.appendValueInput("hz", Number)
    .appendField(Blockly.Msg.ARDUINO_BUZZERHZ)
    this.appendValueInput("delays", Number)
    .appendField(Blockly.Msg.ARDUINO_BUZZERDELAY)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//蜂鸣器播放选择声音
Blockly.Blocks.buzzerplay2 = {
init:function(){
this.setColour(color_do);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_BUZZERPLAY_PIN2)
    .appendField(new Blockly.FieldDropdown([
      ['0', "0"],
      ['1', "1"],
      ['2', "2"],
      ['3', "3"],
      ['4', "4"],
      ['5', "5"],
      ['6', "6"],
      ['7', "7"],
      ['8', "8"],
      ['9', "9"],
      ['10', "10"],
      ['11', "11"],
      ['12', "12"],
      ['13', "13"],
      ['A0', "A0"],
      ['A1', "A1"],
      ['A2', "A2"],
      ['A3', "A3"],
      ['A4', "A4"],
      ['A5', "A5"],
    ]),"buzzerinitss")
	this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_BUZZERPLAY_PLAY)
	.appendField(new Blockly.FieldDropdown([
      [Blockly.Msg.ARDUINO_CONNECTION, "S_connection"],
      [Blockly.Msg.ARDUINO_DISCONNECTION, "S_disconnection"],
      [Blockly.Msg.ARDUINO_BUTTONPUSHED, "S_buttonPushed"],
      [Blockly.Msg.ARDUINO_MODE3, "S_mode3"],
      [Blockly.Msg.ARDUINO_SURPRISE, "S_surprise"],
      [Blockly.Msg.ARDUINO_OHOH, "S_OhOoh"],
      [Blockly.Msg.ARDUINO_OHOH2, "S_OhOoh2"],
      [Blockly.Msg.ARDUINO_CUDDLY, "S_cuddly"],
      [Blockly.Msg.ARDUINO_HAPPY, "S_happy"],
      [Blockly.Msg.ARDUINO_FART1, "S_sad1"],
      [Blockly.Msg.ARDUINO_FART2, "S_sad2"],
    ]),"songs")
		this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_BUZZERPLAY_SOND)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//红外遥控初始化
Blockly.Blocks.kw_initir = {
  init: function() {
    this.setColour(color_do);
    this.appendDummyInput("")
	    .appendField(Blockly.Msg.ARDUINO_IRINITS)
	this.appendValueInput("initir", Number)
      this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
  }
};
//普通遥控器按下
Blockly.Blocks.kw_irKeyPress = {
init:function(){
this.setColour(color_do);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_NORMALIR)
.appendField(new Blockly.FieldDropdown([
  ['1', "IR_KEYCODE_1"],
  ['2', "IR_KEYCODE_2"],
  ['3', "IR_KEYCODE_3"],
  ['4', "IR_KEYCODE_4"],
  ['5', "IR_KEYCODE_5"],
  ['6', "IR_KEYCODE_6"],
  ['7', "IR_KEYCODE_7"],
  ['8', "IR_KEYCODE_8"],
  ['9', "IR_KEYCODE_9"],
  ['0', "IR_KEYCODE_0"],
  ['*', "IR_KEYCODE_STAR"],
  ['#', "IR_KEYCODE_POUND"],
  ['↑', "IR_KEYCODE_UP"],
  ['↓', "IR_KEYCODE_DOWN"],
  ['OK', "IR_KEYCODE_OK"],
  ['←', "IR_KEYCODE_LEFT"],
  ['→', "IR_KEYCODE_RIGHT"],
]),"Irkey")
   this.setOutputShape(Blockly.OUTPUT_SHAPE_HEXAGONAL);
this.setOutput(true, 'Boolean');
this.setTooltip('');
}
};
//emakefun遥控器按下
Blockly.Blocks.kw_irKeyPress2 = {
init:function(){
this.setColour(color_do);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_EMAKEFUNIR)
.appendField(new Blockly.FieldDropdown([
  ['1', "EM_IR_KEYCODE_1"],
  ['2', "EM_IR_KEYCODE_2"],
  ['3', "EM_IR_KEYCODE_3"],
  ['4', "EM_IR_KEYCODE_4"],
  ['5', "EM_IR_KEYCODE_5"],
  ['6', "EM_IR_KEYCODE_6"],
  ['7', "EM_IR_KEYCODE_7"],
  ['8', "EM_IR_KEYCODE_8"],
  ['9', "EM_IR_KEYCODE_9"],
  ['0', "EM_IR_KEYCODE_0"],
  ['A', "EM_IR_KEYCODE_A"],
  ['B', "EM_IR_KEYCODE_B"],
  ['C', "EM_IR_KEYCODE_C"],
  ['D', "EM_IR_KEYCODE_D"],
  ['+', "EM_IR_KEYCODE_PLUS"],
  ['-', "EM_IR_KEYCODE_REDUCE"],
  ['↑', "EM_IR_KEYCODE_UP"],
  ['↓', "EM_IR_KEYCODE_DOWN"],
  ['OK', "EM_IR_KEYCODE_OK"],
  ['←', "EM_IR_KEYCODE_LEFT"],
  ['→', "EM_IR_KEYCODE_RIGHT"],
]),"Irkey2")
   this.setOutputShape(Blockly.OUTPUT_SHAPE_HEXAGONAL);
this.setOutput(true, 'Boolean');
this.setTooltip('');
}
};
//max7219点阵屏初始化
Blockly.Blocks.initmax7219init = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_INITMAX_DINPIN)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PIN1")
  .appendField(Blockly.Msg.ARDUINO_INITMAXCSPIN)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PIN2")
  .appendField(Blockly.Msg.ARDUINO_INITMAXCLKPIN)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PIN3")
   this.appendValueInput("Horizontalcount", Number)
   .appendField(Blockly.Msg.ARDUINO_MAXHORIZONTALCOUNT)
   /*this.appendValueInput("verticalcount", Number)
   .appendField(Blockly.Msg.ARDUINO_MAXVERTICALCOUNT)*/
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
/*/点阵屏图案下拉
Blockly.Blocks.Matrix_img = {
init: function() {
this.appendDummyInput("").appendField(Blockly.Msg.ARDUINO_MAXIMGS).
appendField(new Blockly.FieldDropdown([
  ["↑", "183c7edb18181818"],
  ["↓", "18181818db7e3c18"],
  ["←", "103060ffff603010"],
  ["→", "080c06ffff060c08"],
  ["♥", "42e7ffffff7e3c18"],
  ["▲", "183c7eff00000000"],
  ["▼", "00000000ff7e3c18"],
  ["◄", "103070f0f0703010"],
  ["►", "080c0e0f0f0e0c08"],
  ["△", "182442ff00000000"],
  ["▽", "00000000ff422418"],
  ["☺", "3c42a581a599423c"],
  ["○", "3c4281818181423c"],
  ["◑", "3c4e8f8f8f8f4e3c"],
  ["◐", "3c72f1f1f1f1723c"],
  ["￥", "4224ff08ff080808"],
  ["Χ", "8142241818244281"],
  ["✓", "0000010204885020"],
  ["□", "007e424242427e00"],
  ["▣", "007e425a5a427e00"],
  ["◇", "1824428181422418"],
  ["♀", "3844444438107c10"],
  ["♂", "0f030579d888d870"],
  ["♪", "0c0e0b080878f860"],
  ["✈", "203098ffff983020"],
  //["卍", "00f21212fe90909e"],
  //["卐", "009e9090fe1212f2"],
  ["︱", "1010101010101010"],
  ["—", "000000ff00000000"],
  ["╱", "0102040810204080"],
  ["＼", "8040201008040201"],
  ["大", "1010fe1010284482"],
  ["中", "1010fe9292fe1010"],
  ["小", "1010105454921070"],
  ["米", "00925438fe385492"],
  ["正", "00fe10105e5050fc"],
  ["囧", "ffa5a5c3bda5a5ff"]
]), "img_");
this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
this.setOutput(true);
this.setTooltip('');
this.setColour(color_display);
this.setTooltip('');
this.setHelpUrl('');
}
};*/
//点阵屏显示
Blockly.Blocks.MAX7219_DisplayChar = {
init:function(){
this.setColour(color_display);
 this.appendDummyInput("")
   .appendField(Blockly.Msg.ARDUINO_MAXPRINT)
   .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    [Blockly.Msg.ARDUINO_MSMILE, "10"],
	[Blockly.Msg.ARDUINO_MBIGSMILE, "11"],
    [Blockly.Msg.ARDUINO_MHAHA, "12"],
    [Blockly.Msg.ARDUINO_MHEART, "13"],
    [Blockly.Msg.ARDUINO_MSURPRISE, "14"],
    [Blockly.Msg.ARDUINO_MLITTLESURPRISE, "15"],
    [Blockly.Msg.ARDUINO_MTONE, "16"],
    [Blockly.Msg.ARDUINO_MTOOTH1, "17"],
    [Blockly.Msg.ARDUINO_MTOOTH2, "18"],
    [Blockly.Msg.ARDUINO_MLINE, "19"],
    [Blockly.Msg.ARDUINO_MCONFUSED, "20"],
	[Blockly.Msg.ARDUINO_MLINE2, "21"],
    [Blockly.Msg.ARDUINO_MSAD1, "22"],
    [Blockly.Msg.ARDUINO_MSAD2, "23"],
    [Blockly.Msg.ARDUINO_MSAD3, "24"],
    ['√', "25"],
    ['×', "26"],
    ['?', "27"],
    [Blockly.Msg.ARDUINO_MLIGHT, "28"],
    [Blockly.Msg.ARDUINO_MMOUTH, "29"],
    [Blockly.Msg.ARDUINO_MMAD, "30"],

  ]),"draw")
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//点阵屏单点亮灭
Blockly.Blocks.max7219singlepoint = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_MAX)
   this.appendValueInput("Xaxis", Number)
   .appendField(Blockly.Msg.ARDUINO_MAXXAXIS)
   this.appendValueInput("Yaxis", Number)
   .appendField(Blockly.Msg.ARDUINO_MAXYAXIS)
   this.appendDummyInput("")
   .appendField(Blockly.Msg.ARDUINO_MAXSET)
   .appendField(new Blockly.FieldDropdown([
     ['ON', "1"],
     ['OFF', "0"],
   ]),"PIN")
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//初始化ds1302
Blockly.Blocks.initds1302 = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_DSINIT_RSTPIN)
   .appendField(new Blockly.FieldDropdown([
     ['0', "0"],
     ['1', "1"],
     ['2', "2"],
     ['3', "3"],
     ['4', "4"],
     ['5', "5"],
     ['6', "6"],
     ['7', "7"],
     ['8', "8"],
     ['9', "9"],
     ['10', "10"],
     ['11', "11"],
     ['12', "12"],
     ['13', "13"],
     ['A0', "A0"],
     ['A1', "A1"],
     ['A2', "A2"],
     ['A3', "A3"],
     ['A4', "A4"],
     ['A5', "A5"],
   ]),"RSTS")
   this.appendDummyInput("")
     .appendField(Blockly.Msg.ARDUINO_DSINITDATPIN)
       .appendField(new Blockly.FieldDropdown([
         ['0', "0"],
         ['1', "1"],
         ['2', "2"],
         ['3', "3"],
         ['4', "4"],
         ['5', "5"],
         ['6', "6"],
         ['7', "7"],
         ['8', "8"],
         ['9', "9"],
         ['10', "10"],
         ['11', "11"],
         ['12', "12"],
         ['13', "13"],
         ['A0', "A0"],
         ['A1', "A1"],
         ['A2', "A2"],
         ['A3', "A3"],
         ['A4', "A4"],
         ['A5', "A5"],
       ]),"DATS")
       this.appendDummyInput("")
         .appendField(Blockly.Msg.ARDUINO_DSINITCLKPIN)
           .appendField(new Blockly.FieldDropdown([
             ['0', "0"],
             ['1', "1"],
             ['2', "2"],
             ['3', "3"],
             ['4', "4"],
             ['5', "5"],
             ['6', "6"],
             ['7', "7"],
             ['8', "8"],
             ['9', "9"],
             ['10', "10"],
             ['11', "11"],
             ['12', "12"],
             ['13', "13"],
             ['A0', "A0"],
             ['A1', "A1"],
             ['A2', "A2"],
             ['A3', "A3"],
             ['A4', "A4"],
             ['A5', "A5"],
           ]),"CLKS")
           this.setPreviousStatement(true,null);
            this.setNextStatement(true,null);
this.setTooltip('');
}
};
//获取ds1302年月日时分秒
Blockly.Blocks.getds1302date = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_DSGETDATE)
    .appendField(new Blockly.FieldDropdown([
      [Blockly.Msg.ARDUINO_GETYEAR, "getYear"],
      [Blockly.Msg.ARDUINO_GETMONTH, "getMonthStr"],
      [Blockly.Msg.ARDUINO_GETDAY, "getDay"],
      [Blockly.Msg.ARDUINO_GETHOUR, "getHour"],
      [Blockly.Msg.ARDUINO_GETMINUTE, "getMinute"],
	  [Blockly.Msg.ARDUINO_GETSECOND, "getSecond"],
      [Blockly.Msg.ARDUINO_GETWEEK, "getDOWStr"],
    ]),"DATES")
      this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
   this.setOutput(true, 'Number');
  this.setTooltip('');
}
};
//ds1302设置时分秒
Blockly.Blocks.setds1302time = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_DSSETTIME)
   this.appendValueInput("hour", Number)
   .appendField(Blockly.Msg.ARDUINO_DSHOUR)
   this.appendValueInput("minute", Number)
   .appendField(Blockly.Msg.ARDUINO_DSMINUTE)
   this.appendValueInput("second", Number)
   .appendField(Blockly.Msg.ARDUINO_DSSECOND)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//ds1302设置年月日
Blockly.Blocks.setds1302date = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_DSSETDATE)
   this.appendValueInput("year", Number)
   .appendField(Blockly.Msg.ARDUINO_DSYEAR)
   this.appendValueInput("month", Number)
   .appendField(Blockly.Msg.ARDUINO_MONTH)
   this.appendValueInput("day", Number)
   .appendField(Blockly.Msg.ARDUINO_DAY)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//初始化ds3231
Blockly.Blocks.initds3231 = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_DS3231INIT_RSTPIN)
           this.setPreviousStatement(true,null);
            this.setNextStatement(true,null);
this.setTooltip('');
}
};
//获取ds3231年月日时分秒
Blockly.Blocks.getds3231date = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_DS3231GETDATE)
    .appendField(new Blockly.FieldDropdown([
      [Blockly.Msg.ARDUINO_GETYEAR2, "getYear()"],
      [Blockly.Msg.ARDUINO_GETMONTH2, "getMonth(Century)"],
      [Blockly.Msg.ARDUINO_GETDAY2, "getDate()"],
      [Blockly.Msg.ARDUINO_GETHOUR2, "getHour(h12, PM)"],
      [Blockly.Msg.ARDUINO_GETMINUTE2, "getMinute()"],
	  [Blockly.Msg.ARDUINO_GETSECOND2, "getSecond()"],
      [Blockly.Msg.ARDUINO_GETWEEK2, "getWeek()"],
    ]),"DATES2")
      this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
   this.setOutput(true, 'Number');
  this.setTooltip('');
}
};
//ds3231设置时分秒
Blockly.Blocks.setds3231time = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_DS3231SETTIME)
   this.appendValueInput("hour2", Number)
   .appendField(Blockly.Msg.ARDUINO_DSHOUR)
   this.appendValueInput("minute2", Number)
   .appendField(Blockly.Msg.ARDUINO_DSMINUTE)
   this.appendValueInput("second2", Number)
   .appendField(Blockly.Msg.ARDUINO_DSSECOND)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//ds3231设置年月日
Blockly.Blocks.setds3231date = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_DS3231SETDATE)
   this.appendValueInput("year2", Number)
   .appendField(Blockly.Msg.ARDUINO_DSYEAR)
   this.appendValueInput("month2", Number)
   .appendField(Blockly.Msg.ARDUINO_MONTH)
   this.appendValueInput("day2", Number)
   .appendField(Blockly.Msg.ARDUINO_DAY)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//rgb初始化
Blockly.Blocks.rgbinit = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_RGBINIT_PIN)
    .appendField(new Blockly.FieldDropdown([
      ['0', "0"],
      ['1', "1"],
      ['2', "2"],
      ['3', "3"],
      ['4', "4"],
      ['5', "5"],
      ['6', "6"],
      ['7', "7"],
      ['8', "8"],
      ['9', "9"],
      ['10', "10"],
      ['11', "11"],
      ['12', "12"],
      ['13', "13"],
      ['A0', "A0"],
      ['A1', "A1"],
      ['A2', "A2"],
      ['A3', "A3"],
      ['A4', "A4"],
      ['A5', "A5"],
    ]),"rgbinits")
    this.appendValueInput("pixel", Number)
    .appendField(Blockly.Msg.ARDUINO_RGBPIXEL)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//rgb显示颜色
Blockly.Blocks.rgbdisplay = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_RGBPIN)
    .appendField(new Blockly.FieldDropdown([
      ['0', "0"],
      ['1', "1"],
      ['2', "2"],
      ['3', "3"],
      ['4', "4"],
      ['5', "5"],
      ['6', "6"],
      ['7', "7"],
      ['8', "8"],
      ['9', "9"],
      ['10', "10"],
      ['11', "11"],
      ['12', "12"],
      ['13', "13"],
      ['A0', "A0"],
      ['A1', "A1"],
      ['A2', "A2"],
      ['A3', "A3"],
      ['A4', "A4"],
      ['A5', "A5"],
    ]),"rgbinits")
    this.appendValueInput("pixel", Number)
    .appendField(Blockly.Msg.ARDUINO_RGBPIXEL2)
    this.appendDummyInput('')
    .appendField(Blockly.Msg.ARDUINO_RGBRVALUE)
    .appendField(new Blockly.FieldTimeAdapter(255, 255, function (index) {}), 'rgbred')
    this.appendDummyInput('')
    .appendField(Blockly.Msg.ARDUINO_RGBGVALUE)
    .appendField(new Blockly.FieldTimeAdapter(255, 255, function (index) {}), 'rgbgreen')
    this.appendDummyInput("")
    .appendField(Blockly.Msg.ARDUINO_RGBBVALUE)
    .appendField(new Blockly.FieldTimeAdapter(255, 255, function (index) {}), 'rgbblue')
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//lm35初始化
Blockly.Blocks.lm35init = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_LM35INIT_PIN)
    .appendField(new Blockly.FieldDropdown([
      ['0', "0"],
      ['1', "1"],
      ['2', "2"],
      ['3', "3"],
      ['4', "4"],
      ['5', "5"],
      ['6', "6"],
      ['7', "7"],
      ['8', "8"],
      ['9', "9"],
      ['10', "10"],
      ['11', "11"],
      ['12', "12"],
      ['13', "13"],
      ['A0', "A0"],
      ['A1', "A1"],
      ['A2', "A2"],
      ['A3', "A3"],
      ['A4', "A4"],
      ['A5', "A5"],
    ]),"lm35inits")
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//lm35获取温度
Blockly.Blocks.lm35gettemp = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_LM35GETTEMP_PIN)
    .appendField(new Blockly.FieldDropdown([
      ['0', "0"],
      ['1', "1"],
      ['2', "2"],
      ['3', "3"],
      ['4', "4"],
      ['5', "5"],
      ['6', "6"],
      ['7', "7"],
      ['8', "8"],
      ['9', "9"],
      ['10', "10"],
      ['11', "11"],
      ['12', "12"],
      ['13', "13"],
      ['A0', "A0"],
      ['A1', "A1"],
      ['A2', "A2"],
      ['A3', "A3"],
      ['A4', "A4"],
      ['A5', "A5"],
    ]),"lm35initss")
    this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
 this.setOutput(true, 'Number');
this.setTooltip('');
}
};
//ds18b20初始化
Blockly.Blocks.ds18b20init = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_DS18B20INIT_PIN)
    .appendField(new Blockly.FieldDropdown([
      ['0', "0"],
      ['1', "1"],
      ['2', "2"],
      ['3', "3"],
      ['4', "4"],
      ['5', "5"],
      ['6', "6"],
      ['7', "7"],
      ['8', "8"],
      ['9', "9"],
      ['10', "10"],
      ['11', "11"],
      ['12', "12"],
      ['13', "13"],
      ['A0', "A0"],
      ['A1', "A1"],
      ['A2', "A2"],
      ['A3', "A3"],
      ['A4', "A4"],
      ['A5', "A5"],
    ]),"DS18B20s")
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//ds18b20获取温度
Blockly.Blocks.ds18b20gettemp = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_DS18B20_PIN)
  //  .appendField(new Blockly.FieldDropdown([
 //     ['0', "0"],
 //     ['1', "1"],
 //     ['2', "2"],
 //     ['3', "3"],
 //     ['4', "4"],
 //     ['5', "5"],
 //     ['6', "6"],
 //     ['7', "7"],
  //    ['8', "8"],
 //     ['9', "9"],
 //     ['10', "10"],
 //     ['11', "11"],
  //    ['12', "12"],
    //  ['13', "13"],
    //  ['A0', "A0"],
   //   ['A1', "A1"],
   //   ['A2', "A2"],
   //   ['A3', "A3"],
  //    ['A4', "A4"],
 //     ['A5', "A5"],
 //   ]),"DS18B20ss")
    .appendField(Blockly.Msg.ARDUINO_DS18B20GETTEMP)
      .appendField(new Blockly.FieldDropdown([
        ['℃', "0"],
        ['℉', "1"],
      ]),"temps")
      this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
   this.setOutput(true, 'Number');
  this.setTooltip('');
}
};
//mpu6050重力感应器初始化
Blockly.Blocks.weightinit = {
  init:function(){
  this.setColour(color_sensor);
  this.appendDummyInput("")
    .appendField(Blockly.Msg.ARDUINO_WEIGHTINIT)
  this.setPreviousStatement(true,null);
  this.setNextStatement(true,null);
  this.setTooltip('');
  }
};
//weightfresh
Blockly.Blocks.weightfresh = {
  init:function(){
  this.setColour(color_sensor);
  this.appendDummyInput("")
    .appendField(Blockly.Msg.ARDUINO_WEIGHTFRESH)
  this.setPreviousStatement(true,null);
  this.setNextStatement(true,null);
  this.setTooltip('');
  }
};
//重力感应器mpu6050获取加速度
Blockly.Blocks.weightgeta = {
  init:function(){
  this.setColour(color_sensor);
  this.appendDummyInput("")
    .appendField(Blockly.Msg.ARDUINO_WEIGHTGET)
      .appendField(new Blockly.FieldDropdown([
        [Blockly.Msg.ARDUINO_WEIGHTXG, "XAxis"],
        [Blockly.Msg.ARDUINO_WEIGHTYG, "YAxis"],
        [Blockly.Msg.ARDUINO_WEIGHTZG, "ZAxis"],
      ]),"weightgetas")
        this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
    this.setOutput(true, 'Number');
    this.setTooltip('');
  }
};

//重力感应器mpu6050获取角度
Blockly.Blocks.weightgetd = {
  init:function(){
  this.setColour(color_sensor);
  this.appendDummyInput("")
    .appendField(Blockly.Msg.ARDUINO_WEIGHTGET)
      .appendField(new Blockly.FieldDropdown([
        [Blockly.Msg.ARDUINO_WEIGHTXANGLE, "XAxis"],
        [Blockly.Msg.ARDUINO_WEIGHTYANGLE, "YAxis"],
      [Blockly.Msg.ARDUINO_WEIGHTZANGLE, "ZAxis"],
      ]),"weightgetds")
        this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
    this.setOutput(true, 'Number');
    this.setTooltip('');
  }
};
//rgb超声波模块初始化
Blockly.Blocks.initrgbultrasonic = {
init:function(){
 this.setColour(color_sensor);
 this.appendDummyInput("")
    .appendField(Blockly.Msg.ARDUINO_INITRGBULTRASONIC)
	.appendField(Blockly.Msg.ARDUINO_ULTRASONICPIN)
     .appendField(new Blockly.FieldDropdown([
       ['0', "0"],
       ['1', "1"],
       ['2', "2"],
       ['3', "3"],
       ['4', "4"],
       ['5', "5"],
       ['6', "6"],
       ['7', "7"],
       ['8', "8"],
       ['9', "9"],
       ['10', "10"],
       ['11', "11"],
       ['12', "12"],
       ['13', "13"],
       ['A0', "A0"],
       ['A1', "A1"],
       ['A2', "A2"],
       ['A3', "A3"],
       ['A4', "A4"],
       ['A5', "A5"],
     ]),"ulPINS")

     this.appendDummyInput("")
	 .appendField(Blockly.Msg.ARDUINO_RGBPIN)
         .appendField(new Blockly.FieldDropdown([
          ['0', "0"],
       ['1', "1"],
       ['2', "2"],
       ['3', "3"],
       ['4', "4"],
       ['5', "5"],
       ['6', "6"],
       ['7', "7"],
       ['8', "8"],
       ['9', "9"],
       ['10', "10"],
       ['11', "11"],
       ['12', "12"],
       ['13', "13"],
       ['A0', "A0"],
       ['A1', "A1"],
       ['A2', "A2"],
       ['A3', "A3"],
       ['A4', "A4"],
       ['A5', "A5"],
     ]),"rgbPINS")

 this.setPreviousStatement(true,null);
   this.setNextStatement(true,null);
 this.setTooltip('');
}
};

/*/rgb超声波模块设置颜色
Blockly.Blocks.rgbultrasonicsetcolor = {
init:function(){
 this.setColour(color_sensor);
 this.appendDummyInput("")
    .appendField(Blockly.Msg.ARDUINO_RGBULTRASONICSETCOLOR)
     .appendField(new Blockly.FieldDropdown([
       [Blockly.Msg.ARDUINO_ALL, "E_RGB_ALL"],
       [Blockly.Msg.ARDUINO_RIGHT, "E_RGB_RIGHT"],
       [Blockly.Msg.ARDUINO_LEFT, "E_RGB_LEFT"],
     ]),"rgbultrasonicposition")
     this.appendDummyInput("")
         .appendField(new Blockly.FieldDropdown([
       [Blockly.Msg.ARDUINO_RED, "RGB_RED"],
       [Blockly.Msg.ARDUINO_GREEN, "RGB_GREEN"],
       [Blockly.Msg.ARDUINO_BLUE, "RGB_BLUE"],
       [Blockly.Msg.ARDUINO_YELLOW, "RGB_YELLOW"],
       [Blockly.Msg.ARDUINO_PURPLE, "RGB_PURPLE"],
       [Blockly.Msg.ARDUINO_WHITE, "RGB_WHITE"],
       [Blockly.Msg.ARDUINO_BLACK, "0x000000"],
     ]),"rgbultrasoniccolor")
 this.setPreviousStatement(true,null);
   this.setNextStatement(true,null);
 this.setTooltip('');
}
};	*/
//rgb超声波模块设置颜色样式
Blockly.Blocks.rgbultrasonicsetcolorstyle = {
init:function(){
 this.setColour(color_sensor);
 this.appendDummyInput("")
    .appendField(Blockly.Msg.ARDUINO_RGBULTRASONICSETCOLOR)
     .appendField(new Blockly.FieldDropdown([
       [Blockly.Msg.ARDUINO_ALL, "E_RGB_ALL"],
       [Blockly.Msg.ARDUINO_RIGHT, "E_RGB_RIGHT"],
       [Blockly.Msg.ARDUINO_LEFT, "E_RGB_LEFT"],
     ]),"rgbultrasonicposition")
     this.appendDummyInput("")
         .appendField(new Blockly.FieldDropdown([
       [Blockly.Msg.ARDUINO_RED, "RGB_RED"],
       [Blockly.Msg.ARDUINO_GREEN, "RGB_GREEN"],
       [Blockly.Msg.ARDUINO_BLUE, "RGB_BLUE"],
       [Blockly.Msg.ARDUINO_YELLOW, "RGB_YELLOW"],
       [Blockly.Msg.ARDUINO_PURPLE, "RGB_PURPLE"],
	   [Blockly.Msg.ARDUINO_ORANGE, "RGB_ORANGE"],
       [Blockly.Msg.ARDUINO_INDIGO, "RGB_INDIGO"],
       [Blockly.Msg.ARDUINO_VIOLET, "RGB_VIOLET"],
	   [Blockly.Msg.ARDUINO_WHITE, "RGB_WHITE"],
       [Blockly.Msg.ARDUINO_BLACK, "0x000000"],
     ]),"rgbultrasoniccolor")
	  this.appendDummyInput("")
	  .appendField(Blockly.Msg.ARDUINO_RGBULTRASONICSTYLE)
         .appendField(new Blockly.FieldDropdown([
		 [Blockly.Msg.ARDUINO_NONE, "E_EFFECT_NONE"],
       [Blockly.Msg.ARDUINO_BREATHING, "E_EFFECT_BREATHING"],
       [Blockly.Msg.ARDUINO_ROTATE, "E_EFFECT_ROTATE"],
       [Blockly.Msg.ARDUINO_FLASH, "E_EFFECT_FLASH"],
     ]),"rgbultrasoniccolorstyle")
 this.setPreviousStatement(true,null);
   this.setNextStatement(true,null);
 this.setTooltip('');
}
};
//设置RGB超声波模块呼吸显示
//Blockly.Blocks.rgbultrasonicsetbreathe = {
//init:function(){
// this.setColour(color_sensor);
// this.appendDummyInput("")
 //   .appendField(Blockly.Msg.ARDUINO_INITRGBULTRASONICSETBREATHE)
  //   .appendField(new Blockly.FieldDropdown([
  //     [Blockly.Msg.ARDUINO_ALL, "E_RGB_ALL"],
   //    [Blockly.Msg.ARDUINO_RIGHT, "E_RGB_RIGHT"],
   //    [Blockly.Msg.ARDUINO_LEFT, "E_RGB_LEFT"],
  //   ]),"rgbultrasonicposition")
   //  this.appendDummyInput("")
//	 .appendField(Blockly.Msg.ARDUINO_ISBREATHE)
 //this.setPreviousStatement(true,null);
 //  this.setNextStatement(true,null);
// this.setTooltip('');
//}
//};
//RGB超声波模块读取超声波距离
Blockly.Blocks.rgbultrasonicreaddistance = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_RGBULTRASONICREADDISTANCE)
      this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
   this.setOutput(true, 'Number');
  this.setTooltip('');
}
};
//七彩led初始化
Blockly.Blocks._7led = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
   .appendField(Blockly.Msg.ARDUINO_7LEDPIN)
    .appendField(new Blockly.FieldDropdown([
      ['0', "0"],
      ['1', "1"],
      ['2', "2"],
      ['3', "3"],
      ['4', "4"],
      ['5', "5"],
      ['6', "6"],
      ['7', "7"],
      ['8', "8"],
      ['9', "9"],
      ['10', "10"],
      ['11', "11"],
      ['12', "12"],
      ['13', "13"],
      ['A0', "A0"],
      ['A1', "A1"],
      ['A2', "A2"],
      ['A3', "A3"],
      ['A4', "A4"],
      ['A5', "A5"],
    ]),"PINS")
this.setPreviousStatement(true,null);
  this.setNextStatement(true,null);
this.setTooltip('');
}
};
//七彩led亮灭
Blockly.Blocks._7ledon = {
init:function(){
 this.setColour(color_display);
 this.appendDummyInput("")
    .appendField(Blockly.Msg.ARDUINO_7LED)
	.appendField(new Blockly.FieldDropdown([
      ['0', "0"],
      ['1', "1"],
      ['2', "2"],
      ['3', "3"],
      ['4', "4"],
      ['5', "5"],
      ['6', "6"],
      ['7', "7"],
      ['8', "8"],
      ['9', "9"],
      ['10', "10"],
      ['11', "11"],
      ['12', "12"],
      ['13', "13"],
      ['A0', "A0"],
      ['A1', "A1"],
      ['A2', "A2"],
      ['A3', "A3"],
      ['A4', "A4"],
      ['A5', "A5"],
    ]),"PINS")
         .appendField(new Blockly.FieldDropdown([
           [Blockly.Msg.ARDUINO_LEDON, "1"],
           [Blockly.Msg.ARDUINO_LEDOFF, "0"],
         ]),"STATE")
 this.setPreviousStatement(true,null);
   this.setNextStatement(true,null);
 this.setTooltip('');
}
};
//7段数码管
Blockly.Blocks._7duanshumaguaninit = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_7SHUMAGUANCHUSHIHUA)
  .appendField(Blockly.Msg.ARDUINO_A)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINA")
  .appendField(Blockly.Msg.ARDUINO_B)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINB")
   .appendField(Blockly.Msg.ARDUINO_C)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINC")
  .appendField(Blockly.Msg.ARDUINO_D)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PIND")
   .appendField(Blockly.Msg.ARDUINO_E)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINE")
  .appendField(Blockly.Msg.ARDUINO_F)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINF")
   .appendField(Blockly.Msg.ARDUINO_G)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PING")
  .appendField(Blockly.Msg.ARDUINO_H)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINH")
  this.setPreviousStatement(true,null);
   this.setNextStatement(true,null);
  this.setTooltip('');
  }
  };
//7段数码管显示数字
Blockly.Blocks._7duanshumaguandisplay = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_7SHUMAGUANDISPLAY)
  this.appendValueInput("_7duanshumaguandisplays", Number)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//4位7段数码管初始化
Blockly.Blocks._4x7duanshumaguaninit = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_4X7SHUMAGUANCHUSHIHUA)
  .appendField(Blockly.Msg.ARDUINO_A)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINA")
  .appendField(Blockly.Msg.ARDUINO_B)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINB")
   .appendField(Blockly.Msg.ARDUINO_C)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINC")
  .appendField(Blockly.Msg.ARDUINO_D)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PIND")
   .appendField(Blockly.Msg.ARDUINO_E)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINE")
  .appendField(Blockly.Msg.ARDUINO_F)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINF")
   .appendField(Blockly.Msg.ARDUINO_G)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PING")
  .appendField(Blockly.Msg.ARDUINO_H)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PINH")
  .appendField(Blockly.Msg.ARDUINO_D1)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PIND1")
  .appendField(Blockly.Msg.ARDUINO_D2)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PIND2")
   .appendField(Blockly.Msg.ARDUINO_D3)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PIND3")
  .appendField(Blockly.Msg.ARDUINO_D4)
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"PIND4")
  this.setPreviousStatement(true,null);
   this.setNextStatement(true,null);
  this.setTooltip('');
  }
  };
  //4位7段数码管显示数字
Blockly.Blocks._4x7duanshumaguandisplay = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_4X7SHUMAGUANDISPLAY)
  this.appendValueInput("_4x7duanshumaguandisplays", Number)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//矩阵键盘初始化
Blockly.Blocks.sqaurekeyinit = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_SQUAREKEYINIT)
  .appendField("ROW_1")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"row1")
  .appendField("ROW_2")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"row2")
   .appendField("ROW_3")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"row3")
  .appendField("ROW_4")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"row4")
   .appendField("COL_1")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"col1")
  .appendField("COL_2")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"col2")
   .appendField("COL_3")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"col3")
  .appendField("COL_4")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"col4")
  this.setPreviousStatement(true,null);
   this.setNextStatement(true,null);
  this.setTooltip('');
  }
  };
  //矩阵键盘获取的值
  Blockly.Blocks.sqaurekeygetkey = {
  init:function(){
  this.setColour(color_sensor);
  this.appendDummyInput("")
    .appendField(Blockly.Msg.ARDUINO_SQUAREGETKEY)
        this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
     this.setOutput(true, 'Number');
    this.setTooltip('');
  }
  };
//矩阵键盘是否获取到值
Blockly.Blocks.sqaurekeyisgetkey = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_SQUAREISGETKEY)
      this.setOutputShape(Blockly.OUTPUT_SHAPE_HEXAGONAL);
   this.setOutput(true, 'Boolean');
  this.setTooltip('');
}
};
//rfid初始化
Blockly.Blocks.rfidinit = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
   .appendField(Blockly.Msg.ARDUINO_RFIDINIT)
     .appendField("SDA")
    .appendField(new Blockly.FieldDropdown([
      ['10', "10"],
    ]),"sdaPINS")
    .appendField("SCK")
   .appendField(new Blockly.FieldDropdown([
     ['13', "13"],
   ]),"sckPINS")
   .appendField("MOSI")
  .appendField(new Blockly.FieldDropdown([
    ['11', "11"],
  ]),"mosiPINS")
  .appendField("MISO")
 .appendField(new Blockly.FieldDropdown([
   ['12', "12"],
 ]),"misoPINS")
this.setPreviousStatement(true,null);
  this.setNextStatement(true,null);
this.setTooltip('');
}
};
//rfid是否侦测到信号？
Blockly.Blocks.rfidiscard = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_RFIDISCARD)
      this.setOutputShape(Blockly.OUTPUT_SHAPE_HEXAGONAL);
   this.setOutput(true, 'Boolean');
  this.setTooltip('');
}
};
//rfid所读卡的卡号
Blockly.Blocks.rfidreadcard = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_RFIDREADCARD)
      this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
   this.setOutput(true, 'Number');
  this.setTooltip('');
}
};
//8x8ledinit 8x8点阵屏初始化
Blockly.Blocks.x8ledinit = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO_8X8LEDINIT)
  .appendField("ROW_0")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"ROW_0s")
  .appendField("ROW_1")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"ROW_1s")
   .appendField("ROW_2")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"ROW_2s")
  .appendField("ROW_3")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"ROW_3s")
   .appendField("ROW_4")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"ROW_4s")
  .appendField("ROW_5")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"ROW_5s")
   .appendField("ROW_6")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"ROW_6s")
  .appendField("ROW_7")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"ROW_7s")
  .appendField("LED_A")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"LED_A1")
  .appendField("LED_B")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"LED_B1")
   .appendField("LED_C")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"LED_C1")
  .appendField("LED_D")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"LED_D1")
   .appendField("LED_E")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"LED_E1")
  .appendField("LED_F")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"LED_F1")
   .appendField("LED_G")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"LED_G1")
  .appendField("LED_H")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"LED_H1")
  this.setPreviousStatement(true,null);
   this.setNextStatement(true,null);
  this.setTooltip('');
  }
  };
  //8x8led点阵屏显示
  Blockly.Blocks.x8leddisplay = {
  init:function(){
  this.setColour(color_display);
   this.appendDummyInput("")
     .appendField(Blockly.Msg.ARDUINO_X8LEDDISPLAY)
     .appendField(new Blockly.FieldDropdown([
      ['0', "0"],
      ['1', "1"],
      ['2', "2"],
      ['3', "3"],
      ['4', "4"],
      ['5', "5"],
      ['6', "6"],
      ['7', "7"],
      ['8', "8"],
      ['9', "9"],
      [Blockly.Msg.ARDUINO_MSMILE, "10"],
  	[Blockly.Msg.ARDUINO_MBIGSMILE, "11"],
      [Blockly.Msg.ARDUINO_MHAHA, "12"],
      [Blockly.Msg.ARDUINO_MHEART, "13"],
      [Blockly.Msg.ARDUINO_MSURPRISE, "14"],
      [Blockly.Msg.ARDUINO_MLITTLESURPRISE, "15"],
      [Blockly.Msg.ARDUINO_MTONE, "16"],
      [Blockly.Msg.ARDUINO_MTOOTH1, "17"],
      [Blockly.Msg.ARDUINO_MTOOTH2, "18"],
      [Blockly.Msg.ARDUINO_MLINE, "19"],
      [Blockly.Msg.ARDUINO_MCONFUSED, "20"],
  	[Blockly.Msg.ARDUINO_MLINE2, "21"],
      [Blockly.Msg.ARDUINO_MSAD1, "22"],
      [Blockly.Msg.ARDUINO_MSAD2, "23"],
      [Blockly.Msg.ARDUINO_MSAD3, "24"],
      ['√', "25"],
      ['×', "26"],
      ['?', "27"],
      [Blockly.Msg.ARDUINO_MLIGHT, "28"],
      [Blockly.Msg.ARDUINO_MMOUTH, "29"],
      [Blockly.Msg.ARDUINO_MMAD, "30"],

    ]),"draws")
  this.setPreviousStatement(true,null);
   this.setNextStatement(true,null);
  this.setTooltip('');
  }
};
//不断扫描显示x8ledloopscan
Blockly.Blocks.x8ledloopscan = {
init:function(){
this.setColour(color_display);
 this.appendDummyInput("")
   .appendField(Blockly.Msg.ARDUINO_X8LEDLOOPSCAN)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//74h初始化 74hinit
Blockly.Blocks._74hinit = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
.appendField(Blockly.Msg.ARDUINO__74HINIT)
  .appendField("BIT_CHOICE_1")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"BIT_CHOICE_11")
  .appendField("BIT_CHOICE_2")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"BIT_CHOICE_22")
   .appendField("BIT_CHOICE_3")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"BIT_CHOICE_33")
  .appendField("BIT_CHOICE_4")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"BIT_CHOICE_44")
   .appendField("STCP_PIN")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"STCP_PIN1")
  .appendField("SHCP_PIN")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"SHCP_PIN1")
   .appendField("DATA_PIN")
  .appendField(new Blockly.FieldDropdown([
    ['0', "0"],
    ['1', "1"],
    ['2', "2"],
    ['3', "3"],
    ['4', "4"],
    ['5', "5"],
    ['6', "6"],
    ['7', "7"],
    ['8', "8"],
    ['9', "9"],
    ['10', "10"],
    ['11', "11"],
    ['12', "12"],
    ['13', "13"],
    ['A0', "A0"],
    ['A1', "A1"],
    ['A2', "A2"],
    ['A3', "A3"],
    ['A4', "A4"],
    ['A5', "A5"],
  ]),"DATA_PIN1")
  this.setPreviousStatement(true,null);
   this.setNextStatement(true,null);
  this.setTooltip('');
  }
  };
//74h数码管显示 _74hinitisplay
Blockly.Blocks._74hinitisplay = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_74HDISPLAY)
  this.appendValueInput("_74hinitisplays", Number)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//74h熄灭 _74hoff
Blockly.Blocks._74hoff = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_74HOFF)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//获取系统时间 getnowtime
Blockly.Blocks.getnowtime = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_GETNOWTIME)
      this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
   this.setOutput(true, 'Number');
  this.setTooltip('');
}
};
//hx711init
Blockly.Blocks.hx711init = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_HX711INIT)
this.setPreviousStatement(true,null);
 this.setNextStatement(true,null);
this.setTooltip('');
}
};
//hx711getweight
Blockly.Blocks.hx711getweight = {
init:function(){
this.setColour(color_sensor);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_HX711GETWEIGHT)
      this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
   this.setOutput(true, 'Number');
  this.setTooltip('');
}
};







//字符串转int
Blockly.Blocks.stringtoint = {
init:function(){
this.setColour(color_display);
this.appendDummyInput("")
  .appendField(Blockly.Msg.ARDUINO_STRINGTOINT)
    this.appendValueInput("stringtoints", Number)
      this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
   this.setOutput(true, 'Number');
  this.setTooltip('');
}
};

//字符串转int
Blockly.Blocks.sensing_touchingcolor11 = {
  init:function(){
  this.setColour(color_display);
  this.appendDummyInput("")
    .appendField("test")
      this.appendValueInput("COLOR", Number)
        this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
     this.setOutput(true, 'Number');
    this.setTooltip('');
  }
  };







    return Blockly;
 }

module.exports = ArduinoUnoBlocks ;
